import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsMobilePhone, IsString, MinLength } from 'class-validator'
export class CreateUserDto {
  @IsNotEmpty({ message: '手机号码不得为空' })
  @IsMobilePhone('zh-CN', { strictMode: false }, { message: '手机号码格式不正确' })
  @ApiProperty({ type: 'string', required: true, description: '手机号码' })
  readonly phone: string;

  @IsString()
  @IsNotEmpty({ message: '昵称不得为空' })
  @ApiProperty({ type: 'string', required: true, description: '昵称' })
  readonly name: string;

  @IsString()
  @MinLength(6)
  @IsNotEmpty({ message: '密码不得为空' })
  @ApiProperty({ type: 'string', required: true, description: '密码' })
  readonly password: string;
  
  @IsString()
  @ApiProperty({ type: 'string', required: true, description: '邮箱' })
  readonly email: string;

  @IsString()
  @ApiProperty({ type: 'string', required: false, description: '头像' })
  readonly avatar?: string;

  @IsString()
  @ApiProperty({ type: 'string', required: false, description: '个人介绍' })
  readonly desc?: string;
}
